package com.egg.ylt.presenter.impl;

import android.content.Intent;

import com.egg.ylt.Utils.API;
import com.egg.ylt.Utils.Constants;
import com.egg.ylt.activity.ACT_PhotoBrowser;
import com.egg.ylt.pojo.CurrentBabyInfoEntity;
import com.egg.ylt.pojo.GrowthPhotoClassicListEntity;
import com.egg.ylt.view.IGrowthStampView;
import com.yonyou.framework.library.bean.ErrorBean;
import com.yonyou.framework.library.mvp.impl.BasePresenter;
import com.yonyou.framework.library.net.ReqCallBack;
import com.yonyou.framework.library.net.RequestManager;

import java.util.HashMap;

/**
 * Created By Dlx
 * on 2019/3/1
 */
public class GrowthStampPresenter extends BasePresenter<IGrowthStampView> {


    public void getGrowthStampPhotoClassicDatas() {
        HashMap<String, String> parms = new HashMap<>();
        parms.put("token", Constants.TOKEN);
        parms.put("companyId", Constants.COMPANYID);
        parms.put("babyId", Constants.BABYID);
        RequestManager.getInstance().requestGetByAsyn(API.GET_BABY_GROWTH_STAMP_LIST, parms, new ReqCallBack<GrowthPhotoClassicListEntity>() {

            @Override
            public void onReqSuccess(GrowthPhotoClassicListEntity result) {
                mView.onPhotosClassicListSuccess(result);
            }

            @Override
            public void onFailure(String result) {
                mView.onPhotosClassicListFailed(result);
                mView.showToast(result);

            }

            @Override
            public void onReqFailed(ErrorBean error) {
                mView.showToast(error.getMsg());

            }
        });
    }

    /**
     * 根据name 和type跳转至某分类照片列表
     *
     * @param name
     * @param type
     */
    public void jumpToBabyPhotosListActivity(String name, String type) {
        mContext.startActivity(new Intent(mContext, ACT_PhotoBrowser.class)
                .putExtra(Constants.GROWTH_STAMP_ITEM_TYPE, type).putExtra(Constants.GROWTH_STAMP_DATE, name));
    }
}
